Check the validity of password

re.search(“[a-z]”) re.search(“[$#@]”)

Check the validity of password input by users.
Validation :
At least 1 letter between [a-z] and 1 letter between [A-Z].
At least 1 number between [0-9].
At least 1 character from [$#@].
Minimum length 6 characters.
Maximum length 16 characters.
import re

pwd = input("Input your password: ")

x = True
while x:
    if (len(pwd) < 6 or len(pwd) > 12):
        break
    elif not re.search("[a-z]", pwd):
        break
    elif not re.search("[0-9]", pwd):
        break
    elif not re.search("[A-Z]", pwd):
        break
    elif not re.search("[$#@]", pwd):
        break
    elif re.search("\s",pwd):
        break
    else:
        print("Valid Password")
        x = False
        break

if x:
    print("Not a Valid Password")

Output:

Input your password: W3r@100a
Valid Password